<template>
  <div class="not-found">
    <div class="content">
      <div class="image">
        <img src="@/assets/images/404.svg" alt="404" />
      </div>
      <div class="text">
        <h1>404</h1>
        <h2>抱歉，您访问的页面不存在</h2>
        <p>可能是链接地址有误或者该页面已被删除</p>
        <a-button type="primary" @click="goHome">返回首页</a-button>
        <a-button @click="goBack" style="margin-left: 16px;">返回上一页</a-button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

// 跳转到首页
const goHome = () => {
  router.push('/')
}

// 返回上一页
const goBack = () => {
  router.back()
}
</script>

<style scoped>
.not-found {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #f5f7fa;
}

.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 800px;
}

.image {
  margin-bottom: 32px;
}

.image img {
  max-width: 100%;
  height: auto;
  max-height: 300px;
}

.text {
  text-align: center;
}

.text h1 {
  font-size: 72px;
  font-weight: 700;
  color: #1890ff;
  margin-bottom: 8px;
}

.text h2 {
  font-size: 24px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.85);
  margin-bottom: 16px;
}

.text p {
  font-size: 16px;
  color: rgba(0, 0, 0, 0.45);
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .content {
    flex-direction: row;
    align-items: center;
  }
  
  .image {
    margin-right: 48px;
    margin-bottom: 0;
  }
  
  .text {
    text-align: left;
  }
}
</style>
